<div class="container">
    <div class="invoice">
        <header>
            <section>
                <h1 id="Invtitle">Invoice</h1>
                <span id="Invtime">16/02/2016</span>
            </section>

            <section>
                <span  id="InvID">89 289</span>
            </section>
        </header>

        <main>
            <section>
                <span>Product</span>
                <span>Unit</span>
                <span>Price</span>
            </section>

            <section  id="InvPro">
                <figure>
                    <span><strong>金币</strong> (万)</span>
                    <span id="goldcoin"></span>
                    <span id="bacsumn"></span>
                </figure>
            </section>

            <section>
                <span>Total</span>
                <span  id="InvTotal">9.90</span>
            </section>

        </main>
        <section>
            <span>备注:</span>
            <span  id="Invbill_comment"></span>
        </section>
        <footer>
            <a id="commuinicate" target="_blank" href="">联系</a>
            <a id="closeinv">关闭</a>
        </footer>
    </div>
</div>
<script>
    $(function () {

        var layid = location.hash.replace(/^#bill_id=/, '');
        $.getJSON('getBillsById/'+layid,function (data) {
            var total = "";
            if(data[0]["bill_mode"] == "收入"){
                total = "<span style='color: green'>↑$" + data[0]["bill_sum"] + "</span>";
            }else {
                total = "<span style='color: red'>↓$" + data[0]["bill_sum"] + "</span>";
            }
            $("#InvTotal").html(total);
            $("#InvID").text(data[0]["bill_id"]);
            $("#Invtitle").text(data[0]["bill_mode"]);
            $("#Invtime").text(data[0]["bill_time"]);
            $("#goldcoin").text(data[0]["bill_gold"]);
            $("#bacsumn").text(data[0]["bill_sum"]);
            $("#Invbill_comment").text(data[0]["bill_comment"]);
            $("#commuinicate").attr("href","http://wpa.qq.com/msgrd?v=3&uin="+data[0]["bill_target"]+"&site=qq&menu=yes");
        });
    });
    $("#closeinv").click(function () {
        layer.closeAll();
    });
</script>